package com.abc.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;

/**
 * Milvus配置属性类
 * 通过配置文件自动注入Milvus相关配置
 * 
 * @author abc
 * @since 2024-01-01
 */
@Data
@Component
@RefreshScope
@ConfigurationProperties(prefix = "spring.ai.vectorstore.milvus")
public class MilvusProperties {

    /**
     * 客户端配置
     */
    private Client client = new Client();

    /**
     * 数据库名称
     */
    private String databaseName = "knowledge_platform";

    /**
     * 集合名称
     */
    private String collectionName = "embedding";

    /**
     * 向量维度
     */
    private int embeddingDimension = 1024;

    /**
     * 索引类型
     */
    private String indexType = "IVF_FLAT";

    /**
     * 距离度量类型
     */
    private String metricType = "COSINE";

    @Data
    public static class Client {
        /**
         * 主机地址
         */
        private String host = "localhost";

        /**
         * 端口号
         */
        private int port = 19530;

        /**
         * 用户名
         */
        private String username = "root";

        /**
         * 密码
         */
        private String password = "milvus";
    }
}

